package com.itheima.service.impl;

import com.itheima.dao.BookDao;
import com.itheima.dao.UserDao;
import com.itheima.service.UserService;

public class UserServiceImpl implements UserService {

    private int num;
    private UserDao userDao;
    private BookDao bookDao;

    public UserServiceImpl() {
    }

    public UserServiceImpl(int num, UserDao userDao, BookDao bookDao) {
        this.num = num;
        this.userDao = userDao;
        this.bookDao = bookDao;
    }

    //对需要进行注入的变量添加set方法
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public void setBookDao(BookDao bookDao) {
        this.bookDao = bookDao;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public void save() {
        System.out.println("userService执行" + num);
        userDao.save();
        bookDao.save();
    }
}
